using System;
using UnityEngine;

[Serializable]
public class OptionsButtons3D : MonoBehaviour
{
	public AudioClip clip;

	public Color pressed;

	public Color unpressed;

	public Collider audi;

	public Collider controls;

	public Collider graphics;

	public Collider stats;

	public Collider back;

	public bool state;

	public Camera mainCamera;

	public autocalibrateonoff script;

	public GameObject statistics;

	public void Update()
	{
		if (state)
		{
			return;
		}
		if (Input.GetMouseButtonUp(0))
		{
			st();
		}
		if (!Input.GetMouseButtonDown(0))
		{
			return;
		}
		RaycastHit hitInfo = default(RaycastHit);
		if (Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f))
		{
			if (hitInfo.collider.name == "Audio")
			{
				AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
				audi.GetComponent<Renderer>().material.color = pressed;
				audi.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				script.showaudio = true;
				script.showvideo = false;
				script.showcontrol = false;
			}
			if (hitInfo.collider.name == "Graphics")
			{
				AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
				graphics.GetComponent<Renderer>().material.color = pressed;
				graphics.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				script.showaudio = false;
				script.showvideo = true;
				script.showcontrol = false;
			}
			if (hitInfo.collider.name == "Controls")
			{
				AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
				controls.GetComponent<Renderer>().material.color = pressed;
				controls.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				script.showaudio = false;
				script.showvideo = false;
				script.showcontrol = true;
			}
			if (hitInfo.collider.name == "Stats")
			{
				AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
				stats.GetComponent<Renderer>().material.color = pressed;
				stats.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				statistics.SetActiveRecursively(state: true);
			}
			if (hitInfo.collider.name == "Back")
			{
				AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
				back.GetComponent<Renderer>().material.color = pressed;
				back.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
				UnityEngine.SceneManagement.SceneManager.LoadScene("mainmenu2");
			}
		}
	}

	public void st()
	{
		audi.GetComponent<Renderer>().material.color = unpressed;
		controls.GetComponent<Renderer>().material.color = unpressed;
		graphics.GetComponent<Renderer>().material.color = unpressed;
		back.GetComponent<Renderer>().material.color = unpressed;
		stats.GetComponent<Renderer>().material.color = unpressed;
		stats.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		audi.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		controls.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		graphics.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
		back.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
	}

	public void Main()
	{
	}
}
